﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace PJ.Data
{
    [Serializable]
    [DataContract]
    public abstract class BaseLinkData : BaseObjectData, ILinkData
    {
        private string m_LeftID;

        [DataMember]
        public string LeftId
        {
            get { return m_LeftID; }
            set { m_LeftID = value; }
        }

        private string m_RightID;

        [DataMember]
        public string RightId
        {
            get { return m_RightID; }
            set { m_RightID = value; }
        }

        protected BaseLinkData()
        {
        }
        protected BaseLinkData(ILinkData data) : base(data)
        {
        }
        public override IObjectData Copy(IObjectData data)
        {
            base.Copy(data);
            ILinkData link = (ILinkData)data;
            this.LeftId = link.LeftId;
            this.RightId = link.RightId;
            return this;
        }
        public override bool IsEqual(IObjectData data)
        {
            if (base.IsEqual(data))
            {
                ILinkData link = (ILinkData)data;
                if (link.LeftId == this.LeftId)
                    if (link.RightId == this.RightId)
                        return true;
            }
            return false;
        }


    }
}
